package com.xbj.springmvc.core.util;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class InstallFormUtil {

	public static Object install(Class clazz, HttpServletRequest request) {
		Object bean = null;
		try {

			bean = (Object) clazz.newInstance();
			Field[] fs = clazz.getDeclaredFields();
			for (Field f : fs) {
				f.setAccessible(true);
				f.set(bean, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return bean;
	}
}
